<form class="form-horizontal pd10" id="apply_scholarship_text" <if condition="$apply['id']">style="display:none"</if>>
    <div class="form-group">
        <div class="col-sm-12">
            <{:dict( 'registerForExamination')}>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-2"></div>
        <div class="col-sm-8">
            <button type="button" class="btn-primary btn border-radius-none btn-lg" onclick="$('#apply_scholarship_text').hide();$('#apply_scholarship').show();hiApp.set_modal_postion($('#modal_popup_registerForExamination'))">确定 </button>
        </div>
    </div>
</form>
<form class="form-horizontal pd10" action="<{:U('Index/doRegisterForExamination')}>" <if condition="!$apply['id']">style="display:none"</if> method="post" id="apply_scholarship">
    <input type="hidden" name="class_id" value="<{$class_id}>" />
    <input type="hidden" name="id" value="<{$apply.id}>" />
    <input type="hidden" name="subjectid" value="<{$subjectid}>" />
    <php>$from_id=($apply['id'] && $apply['status'] == 5 )?"apply_scholarship":'';</php>
    <{:displayFormGroupHtml( "table_apply_examination_".$subjectid,$apply,$from_id)}>
        <div class="info-box">
            <div class="info-hd">确认操作</div>
            <div class="data-box">
                <if condition="$apply['status']">
                    <div class="form-group">
                        <div class="col-sm-2"></div>
                        <div class="col-sm-8"> <strong style=" color:red">
												 <{$apply['statusText']}>
												</strong>
                            <if condition="$apply['remark'] and $apply['status'] eq 3">
                                <p>备注：
                                    <{$apply.remark}>
                                </p>
                            </if>
                        </div>
                    </div>
                </if>
                <div class="form-group">
                    <div class="col-sm-2"></div>
                    <div class="col-sm-8">
                        <if condition=" $apply['status'] neq 5">
                            <button type="submit" class="btn-primary btn border-radius-none btn-lg">确认报名信息</button>
                        </if>
                        <a class="btn-info btn border-radius-none btn-lg" data-dismiss="modal" aria-label="Close">关闭</a>
                    </div>
                </div>
            </div>
        </div>
</form>
<script>
$(function() {

    $("#apply_scholarship")._bootstrapValidator({
        excluded: ':disabled',
        submitHandler: null,
        trigger: null,
        fields: {
            content: {
                validators: {
                    notEmpty: {
                        message: '请上传资料'
                    }
                }
            },
            Idcard: {
                validators: {
                    notEmpty: {
                        message: '请填写身份证信息'
                    },
                    callback: {
                        message: '请填写正确的身份证号,并且大于18岁',
                        callback: function(idCard, validator) {
                            idCard = idCard.toUpperCase();
                            if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(idCard))) {
                                return false;
                            }
                            if (idCard.length == 15) {
                                birthday = "19" + idCard.substr(6, 6);
                            } else if (idCard.length == 18) {
                                birthday = idCard.substr(6, 8);
                            }
                            birthday = birthday.substr(0, 4);
                            var myDate = new Date();
                            var year = myDate.getFullYear();
                            if ((year - birthday) < 18) {
                                return false;
                            }
                            //	console.log(birthday);
                            //birthday = birthday.replace(/(.{4})(.{2})/,"$1-$2-");  
                            return true;
                        }
                    }
                }
            }
        }
    });



    $("[name='content']").on("BoxUploadAdd", function(event) {
        $("#apply_scholarship").data('bootstrapValidator').updateStatus("content", 'NOT_VALIDATED', null).validateField("content");
    });

    $("[name='content']").on("BoxUploadDel", function(event) {
        $("#apply_scholarship").data('bootstrapValidator').updateStatus("content", 'NOT_VALIDATED', null).validateField("content");
    });

    $("#apply_scholarship").on("ajaxSubmitSuccess", function(event, content) {
        var data = JSON.parse(content);
        if (data.error == 0) {
            // alert(data.msg);
            $("#examination_id").val(data.msg);
            dialog("已经确认报考信息");
            $("#apply_scholarship").parents(".modal_popup").modal("hide");

        } else {
            dialog(data.mag);
        }
        //  console.log(data);
    })

})
</script>
